<?php

require_once("DAO.php");

class AuthorDAO extends DAO
{
	private $conn;
	private $databaseSelected;
	
	function __construct()
	{
	}

	function findAll()
	{
		$authors = array();
		for($i=1;$i<=100;$i++)
		{
			$authors[]= new Author($i, "author name ".$i, $i+1, $i*99);
		}
        return $authors;
	}
	function findRandom()
	{
		return new Author(1, "author name PUDDING", 10, 1);
	}

	function findById($id)
	{
		return new Author($id, "author name PUDDING".$id, $id*10,  1);
	}
	function findYearsBySchool($schoolId)
	{
		$authors = array();
		for($i=1;$i<=4;$i++)
		{
			$authors[]= new Author($i, "author name ".$i, $i+1, $i*99);
		}
		$years = array();
        foreach($authors as $a)
		{
			$years[]= $a->year;
		}
		return $years;
	}
	function findBySchoolYear($schoolId, $year)
	{
		$authors = array();
		for($i=1;$i<=4;$i++)
		{
			$authors[]= new Author($i, "author name ".$i, $year, $i*99);
		}
		return $authors;
	}
	function getDoodles($author)
	{
		$doodles = array();
		for($i=1;$i<=3;$i++)
		{
			$doodles[]= new Doodle($i, "doodle name ".$i, "description ".$i, "url ".$i, $author->id);
		}
        return $doodles;
	}
}
?>